﻿using Furion.DependencyInjection;
using JiaNetFrame.Application.System.Models;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace JiaNetFrame.Application.System.Services
{
    public class UserService : IUserService, ITransient
    {
        private readonly ISqlSugarRepository<UserInfo> repository; // 仓储对象：封装简单的CRUD
        private readonly ISqlSugarClient db; // 核心对象：拥有完整的SqlSugar全部功能
        public UserService(ISqlSugarRepository<UserInfo> sqlSugarRepository)
        {
            repository = sqlSugarRepository;
            db = repository.Context;    // 推荐操作
        }
        public string add()
        {
            throw new NotImplementedException();
        }

        public DataTable search()
        {
            var dt = db.Ado.GetDataTable("select * from sys_user_info");
            
            return dt;
        }

        //string IUserService.search()
        //{
        //    var dt = db.Ado.GetDataTable("select * from sys_user_info");
        //    return dt.Rows.Count + "";
        //}
    }
}
